//
//  MineHeadTableViewCell.m
//  BaChat
//
//  Created by dllo on 16/6/13.
//  Copyright © 2016年 刘洋. All rights reserved.
//

#import "MineHeadTableViewCell.h"

@implementation MineHeadTableViewCell

-(void)dealloc
{
    [_headPic release];
    [_QRcode release];
    [_arrow release];
    [_userName release];
    [_baChatNum release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createDiscovery];
    }
    return self;
}

-(void)createDiscovery
{
    self.headPic = [[UIImageView alloc] init];
    self.headPic.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.headPic];
    [_headPic release];
    
    
    self.QRcode = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.QRcode setImage:[UIImage imageNamed:@"QRcode"] forState:UIControlStateNormal];
    [self.QRcode addTarget:self action:@selector(QRcodeAction) forControlEvents:UIControlEventTouchUpInside];
      [self.contentView addSubview:self.QRcode];
    [_QRcode release];
    

    
    self.userName = [[UILabel alloc] init];
    self.userName.backgroundColor = [UIColor whiteColor];
    self.userName.font = [UIFont systemFontOfSize:25];
    
    [self.contentView addSubview:self.userName];
    [_userName release];
/*
    self.baChatNum = [[UILabel alloc] init];
    self.baChatNum.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.baChatNum];
    [_baChatNum release];
 
 */
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.headPic.frame = CGRectMake(10, 10, 60, 60);
 
    self.userName.frame = CGRectMake(90, 20, ROOTWIDTH / 2, 40);
    
//    self.baChatNum.frame = CGRectMake(ROOTWIDTH / 5.5 + 20, ROOTWIDTH / 5.5 /2 + 10, ROOTWIDTH / 5.5 * 2, ROOTWIDTH / 5.5 / 2);
    
    self.QRcode.frame = CGRectMake(ROOTWIDTH - 75, self.contentView.frame.size.height / 2 - 20, 40,40);
   
    
}

-(void)QRcodeAction
{
    self.QRcodeBlock();
}



@end
